﻿#include "OperJunctionPointSEA.h"
#include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h"
#include "FITK_Kernel/FITKAppFramework/FITKGlobalData.h"
#include "FITK_Kernel/FITKCore/FITKOperatorRepo.h"
#include "FITK_Component/FITKAcousticsModel/FITKSEAAbstractJunction.h"
#include "OperatorsInterface/GraphEventOperator.h"
#include "updateBrowserTable.h"
#include <QAction>

namespace ModelOper
{
    bool OperJunctionPointSEA::execGUI()
    {
        return false;
    }

    bool OperJunctionPointSEA::execProfession()
    {
        return false;
    }

    void OperJunctionPointSEA::editJunction(const int junID)
    {
        QWidget* mw = FITKAPP->getGlobalData()->getMainWindow();
        //编辑对话框
        QAction action;
        action.setObjectName("actionEditJunctionPoint");
        Core::FITKActionOperator* oper = Core::FITKOperatorRepo::getInstance()->getOperatorT<Core::FITKActionOperator>("actionEditJunctionPoint");
        if (!oper) return;
        oper->setArgs("DataID", junID);
        oper->setEmitter(&action);
        oper->actionTriggered();
    }

    void OperJunctionPointSEA::removeJunction(const int junID)
    {
        //获取管理器
        if (!_junMgr)return;
        //移除并更新列表
        _junMgr->removeDataByID(junID);
        ModelOper::updateBrowserTable();
        EventOper::GraphEventOperator* operGraph = FITKOPERREPO->getOperatorT<EventOper::GraphEventOperator>("GraphPreprocess");
        operGraph->updateJunctions();
    }

    void OperJunctionPointSEA::setAttribute(const QString & name, const QString & text, const int attrIndex, const QList<int>& junIDs)
    {
        //再说
        ModelOper::updateBrowserTable();
    }
}

